using System;
using System.Collections.Generic;
using System.Text;

namespace CGMSharp.Types
{
    class CD : AbstractType
    {
        private List<CCO> val;

        public override int ReadFromStream(System.IO.Stream s)
        {
            int len = 0;
            for (int x = 0; x < Configuration.GetHelper().ColorSegmentCount; x++)
            {
                val.Add(new CCO(Configuration, s));
                len += val[x].Octets() * 8;
            }
            return len;
        }

        public override int WriteToStream(System.IO.Stream s)
        {
            //BinaryUtil.WriteUI(s, Configuration.DirectColorPrecision, val);
            return Configuration.DirectColorPrecision;
        }

        public override int Octets()
        {
            return Configuration.DirectColorPrecision / 8;
        }

        public override string ToString()
        {
            return "CCO";
        }

        public List<CCO> Val
        {
            get { return val; }
            set { val = value; }
        }
    }
}